home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2
/
IRIX 6.2 CD2.iso
/
dist
/
outbox.idb
/
var
/
www
/
cgi-bin
/
webdist.cgi.z
/
webdist.cgi
Wrap
Text File
|
1996-06-10
|
4KB
|
155 lines
#!/usr/sbin/perl
## Copyright 1995, Silicon Graphics, Inc.
## All Rights Reserved.
##
## This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
## the contents of this file may not be disclosed to third parties, copied or
## duplicated in any form, in whole or in part, without the prior written
## permission of Silicon Graphics, Inc.
##
## RESTRICTED RIGHTS LEGEND:
## Use, duplication or disclosure by the Government is subject to restrictions
## as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
## and Computer Software clause at DFARS 252.227-7013, and/or in similar or
## successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
## rights reserved under the Copyright Laws of the United States.
# Process cgi args
if( $ENV{'REQUEST_METHOD'} eq "GET" )
{
$buffer=$ENV{'QUERY_STRING'} ;
}
else
{
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}) ;
}
@pairs = split(/&/, $buffer) ;
foreach (@pairs)
{
tr/+/ / ;
($name,$value)= split(/=/) ;
$value =~ s/%(..)/pack("c",hex($1))/ge ;
$name =~ s/%(..)/pack("c",hex($1))/ge ;
$in{$name} = $value;
}
$distloc=$in{distloc};
$pageloc=$in{pageloc};
if ($distloc eq "") {
&report_fatal_error("<H3>Error: Distribution Directory cannot be empty!</H3>");
}
# Execute webdist here to create the page
$pid = fork;
if ($pid == 0) {
# set environment variable so that xconfirm window is displayed
# this var is not set in a CGI script
$ENV{"DISPLAY"} = ":0.0";
# Close stdout so that xconfirm writes to /dev/null
close(STDOUT);
open(STDOUT, "/dev/null");
exec("/usr/bin/X11/xconfirm",
"-c",
"-exclusive",
"-B", "Dismiss",
"-icon", "info",
"-header", "Web Software Distribution Tool",
"-noframe",
"-t", "The Web Software Distribution Page is being created.",
"-t", "This may take a few minutes if there are many products.",
"-t", "",
"-t", "You may dismiss this dialog at any time without stopping",
"-t", "the Web Distribution Tool by pressing \"Dismiss\".",
"-t", "",
"-t", "You may cancel creating this page by pressing the",
"-t", "\"Stop\" button in your Web browser (eg Netscape).");
exit 0;
}
$output = `/usr/etc/webdist $distloc $pageloc 2>&1`;
kill(2, $pid);
$filename = "/usr/tmp/webdist.$$.html";
if ($? != 0) {
&report_fatal_error($output);
} else {
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<BODY BACKGROUND=\"/webdist/images/background.jpeg\">\n";
unless (open(OUT, ">$filename")) {
print "<H3>Error: Cannot open temporary file $filename</H3>";
} else {
print OUT "$output";
print "<H3 ALIGN=\"CENTER\">Web Software Distribution Page Created.<BR>\n";
print "(You can see what the page will look like below)</H3>\n";
print "<HR>\n";
print "<H3 ALIGN=\"CENTER>Installing the Web Software Distribution Page<BR>\n";
print "(Do this now, while you can still refer to this page for reference)</H3>";
print "<P>\n";
print "The new Web Software Distribution Page has been created at\n";
print "location <SAMP>$filename</SAMP>.\n";
$dist = `basename $distloc`;
chop($dist);
webdist:chop($disthost = `hostname`);
print "<P> You will need to <B>move this file</B> to\n";
print "the location <SAMP>/var/www/htdocs/dist/$dist.html</SAMP>.\n";
print "</P>\n";
print "<HR>\n";
print "<H3 ALIGN=\"CENTER>Using the Web Software Distribution Page</H3>\n";
print "<P>\n";
print "After installing this page, users on the network\n";
print "can install software from it by using\n";
print "the URL <SAMP>http://$disthost/dist/$dist.html</SAMP>.\n";
print "</P>\n";
print "<HR>\n";
print "<P>\n";
print "The following is what the new Web Software Distribution Page will look like:";
print "</P>\n";
print "<HR>\n";
print "$output";
}
}
#
# Report fatal error
#
sub report_fatal_error {
local ($msg) = @_;
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<BODY BACKGROUND=\"/webdist/images/background.jpeg\">\n";
print "<TITLE>Web Software Distribution Tool Error</TITLE>\n";
print "</HEAD>\n";
print "<BODY BACKGROUND=\"webdist/images/background.jpeg\">\n";
print "<H3>Web Software Distribution Tool Error</H3>\n";
print "$msg<P>\n";
print "Return to <A HREF=../webdist.html>webdist</A> page.";
print "</BODY>\n";
exit 1;
}